<?php
class State_model extends CI_Model {

    function __construct()
    {
        parent::__construct();
    }
    
    function get($data)
    {
    	if (isset($data['idcountry']) && is_numeric($data['idcountry'])) {
    		$this->db->where('idcountry', $data['idcountry']);
    	}
    	
    	if (isset($data['shortname']) && $data['shortname'] != '') {
    		$this->db->where('shortname', $data['shortname']);
    	}
    	
    	$this->db->order_by('name');
    	return $this->db->get('state');
    }
}
?>